package com.wtwd.wtwddevice.listener.deviceServerMsg.handler.impl;

import com.wtwd.device.annotation.MsgType;
import com.wtwd.device.constant.MsgTypeEnum;
import com.wtwd.device.mqtentity.MessageBase;
import com.wtwd.wtwddevice.listener.deviceServerMsg.handler.IMsgHandler;
import com.wtwd.wtwddevice.mq.PushMsgService;
import com.wtwd.wtwddevice.service.ISportDataService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 *  //to 代做
 */
@MsgType(MsgTypeEnum.W_SPORTDATA)
@Component
public class SportDataHandlerImpl implements IMsgHandler {

    @Resource
    private ISportDataService sportDataService;

    @Resource
    private PushMsgService msgService;

    @Override
    public void handleMsg(MessageBase messageBase) {
//        WTProtocol wtProtocol = messageBase.getWtProtocol();
//        String body = wtProtocol.getBody();
//        String[] split = body.split(SeparatorConstant.POUND_SIGN);
//        sportDataService.sportDateHandle(split[0],split);
//        wtProtocol.setTime(DateUtils.format(new Date(), DateUtils.dateFormat15));
//        wtProtocol.setBody(String.valueOf(AnswerStateEnum.NORMAL.getState()));
//        wtProtocol.setBodyLength(wtProtocol.getBody().length());
//        wtProtocol.setMesType(CmdTypeEnum.REPORT_RESPONSE.getCmdType().toString());
//        msgService.pushToDevice(messageBase.getForm(),
//                MessageBase.builder().deviceKey(wtProtocol.getImei())
//                        .wtProtocol(wtProtocol)
//                        .build());
    }


}
